package com;







import Untils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Test9 {
    public static void main(String[] args) throws SQLException {
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet set = null;
        try {
         conn = JDBCUtils.getconnection();
         String sql = "SELECT name FROM worker WHERE id= ?";
           ps = conn.prepareStatement(sql);
           ps.setInt(1, 1);
            set = ps.executeQuery();
            while (set.next()){
                String name = set.getString("name");
                System.out.println(name);
            }
        } finally {
          JDBCUtils.close(set,ps,conn);
        }
    }
}
